<%@ page contentType="text/html; charset=euc-kr" %>
<%@ page import = "javax.naming.*"%>
<%@ page import = "javax.sql.*"%>
<%@ page import = "java.sql.*"%>
<%@ page import = "java.sql.Connection"%>
<%
	DataSource ds = null;
	Connection conn = null;
	ResultSet rs = null;
	PreparedStatement pstmt = null;

		try {

			InitialContext ctx = new InitialContext();
			ds = (DataSource) ctx.lookup("java:comp/env/jdbc/term");

			if (ds == null) {
				System.out.println("ds is null");

			}else{

				conn = ds.getConnection();

				if(conn != null){

					
					String query = "Select 1 from dual	";
					pstmt = conn.prepareStatement(query);
					rs = pstmt.executeQuery();

					for (int i=0; i<1; i++){
						if(rs.next()){
							System.out.println(">> "+rs.getString(1)+"<BR>");
						}else{
							System.out.println("------<br>");
						}
						
					}
					

					out.println("conn---------------<br>");
				}else{
					out.println("conn is null ------<br>");
				}


			}

		} catch (NamingException e) {
			System.out.println("null~1");
		} finally {
			if (conn != null )
				conn.close();
		}
	



%>
<html>
</html>
